package com.zlkj.pro.modular.app.controller;

import cn.stylefeng.roses.kernel.auth.api.context.LoginContext;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import com.zlkj.pro.modular.admin.model.dto.DashboardDTO;
import com.zlkj.pro.modular.admin.model.dto.UserDTO;
import com.zlkj.pro.modular.business.service.DashboardService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

import static com.zlkj.pro.core.consts.ProjectConstants.SERVICE_APP_PREFIX;

/**
 * @author liyang
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@ApiResource(name = "报表信息", path = SERVICE_APP_PREFIX + "/dashboard")
public class AppDashboardController {

    private final DashboardService dashboardService;

    @GetResource(name = "客户分析数据", path = "/customer")
    public ResponseData customer(DashboardDTO dto) {
        Map<String, Object> restData = dashboardService.customer(dto);
        return new SuccessResponseData(restData);
    }


    @GetResource(name = "综合统计数据", path = "/customerByMonths")
    public ResponseData customerByMonths(DashboardDTO dto) {
        List<Map<String, Object>> restData = dashboardService.customerByMonths(dto);
        return new SuccessResponseData(restData);
    }

    @GetResource(name = "销售业绩", path = "/salesPerformance")
    public ResponseData salesPerformance(DashboardDTO dto) {
        List<Map<String, Object>> restData = dashboardService.salesPerformance(dto);
        return new SuccessResponseData(restData);
    }

    @GetResource(name = "销售排行", path = "/seniorityUser")
    public ResponseData seniorityUser(DashboardDTO dto) {
        List<Map<String, Object>> restData = dashboardService.seniorityUser(dto);
        return new SuccessResponseData(restData);
    }

}
